package com.wr.hangzhounewlight.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wr.hangzhounewlight.obj.database.RecipeEntity;
import com.wr.hangzhounewlight.obj.vo.frontend.RecipeListVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author yuanzhizhuo
 * createDate 2025/10/27
 */
public interface RecipeMapper extends BaseMapper<RecipeEntity> {

    @Select("""
            select t2.id, t2.silo, t2.ratio
            from `order` as t1
                     left join recipe as t2 on t1.id = t2.order_id
            where t1.order_no = #{orderNo}
              and t1.is_close = 0
            limit 60;
            """)
    List<RecipeEntity> selectRecipe(String orderNo);

    @Select("""
            select t2.silo
            from `order` as t1
                     left join recipe as t2 on t1.id = t2.order_id
            where t1.order_no = #{orderNo}
            limit 60;
            """)
    List<String> selectSilo(String orderNo);

    @Select("""
            select silo, ratio, ratio_act
            from recipe
            where order_id = #{orderId}
            limit 60;
            """)
    List<RecipeListVO.Recipe> selectRecipeVO(String orderId);

}
